using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;

namespace FastFoodToNight.Models.Mapping
{
    public class BanQuanLyMap : EntityTypeConfiguration<BanQuanLy>
    {
        public BanQuanLyMap()
        {
            // Primary Key
            this.HasKey(t => t.tentaikhoan);

            // Properties
            this.Property(t => t.tentaikhoan)
                .IsRequired()
                .HasMaxLength(50);

            this.Property(t => t.matkhau)
                .HasMaxLength(100);

            this.Property(t => t.hoten)
                .HasMaxLength(100);

            this.Property(t => t.diachi)
                .HasMaxLength(200);

            this.Property(t => t.email)
                .HasMaxLength(100);

            this.Property(t => t.sodienthoai)
                .HasMaxLength(20);

            // Table & Column Mappings
            this.ToTable("BanQuanLy");
            this.Property(t => t.tentaikhoan).HasColumnName("tentaikhoan");
            this.Property(t => t.matkhau).HasColumnName("matkhau");
            this.Property(t => t.hoten).HasColumnName("hoten");
            this.Property(t => t.ngaysinh).HasColumnName("ngaysinh");
            this.Property(t => t.gioitinh).HasColumnName("gioitinh");
            this.Property(t => t.diachi).HasColumnName("diachi");
            this.Property(t => t.email).HasColumnName("email");
            this.Property(t => t.sodienthoai).HasColumnName("sodienthoai");
            this.Property(t => t.quyen).HasColumnName("quyen");
        }
    }
}
